<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<%@ taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE HTML>
<html>
<head>
	<title>GRDN LOG</title>
	<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script>
	<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.10/jquery-ui.min.js"></script>
	
	<!-- See http://blog.jqueryui.com/2011/02/jquery-ui-1-8-10/ for more jquery ui theme links  -->
	<link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.0/themes/smoothness/jquery-ui.css" type="text/css" rel="stylesheet" />
	
	<link href="/css/styles.css" type="text/css" rel="stylesheet" />
	
</head>
<body id="log">
	<div id="center-section">
		<div id="header">
			<img src="/images/grdnlog-logo.png" alt="logo" />
			<span style="float:right;"><a href="/mvc/log-config">Config</a> | <a href="${authUrl}">Logout</a></span>
		</div>
		
	    <div id="content">			
	    	<div>
	    		<h2>Posts</h2>
	    		<c:forEach var="entry" items="${entries}">
	    			<div>
	    				<fmt:formatDate value="${entry.date}" pattern="EEE, MMM d, yyyy hh:mm:ss aaa z" />
	    				<form:form method="POST">
							<input type="hidden" name="id" value="<c:out value="${entry.id}" />" />
							<input type="submit" name="delete-entry" value="Delete" />
						</form:form>
	    			</div>
	    			<div><c:out value="${entry.text}" /></div>
	    		</c:forEach>
    		</div>
    		<div>
    			<form:form method="POST">
    				<input type="submit" name="sync" value="Refresh Posts" />
    			</form:form>
    		</div>
		</div>
	</div>
</body>
</html>